//
//  SMAccountCollectionCell.m
//  lishiminOC
//
//  Created by p2p on 16/10/13.
//  Copyright © 2016年 p2p. All rights reserved.
//

#import "SMAccountCollectionCell.h"
#import "SMAccountCollectView.h"

@interface SMAccountCollectionCell()
@property (nonatomic,strong)UICollectionView *accountCollection;
@property (nonatomic,strong)NSMutableArray *viewArray;
@end
@implementation SMAccountCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        //创建View
        [self setupUI];
    }
    return self;
}

- (void)setupUI{
    
    [self creatThreeSubviews];
    
}

- (void)creatThreeSubviews{
    NSMutableArray *mutableViewArray = [NSMutableArray arrayWithCapacity:0];
    for (int i = 0 ; i< 3 ; i++) {
        SMAccountCollectView *view = [[SMAccountCollectView alloc]init];
        view.backgroundColor = [UIColor grayColor];
        if (i < 2) {
            
            [view setViewWithArray:[self setDataInTheUIWithInNumber][i] andDisplayIntervalView:NO];
        }else{
            
            [view setViewWithArray:[self setDataInTheUIWithInNumber][i] andDisplayIntervalView:YES];
        }
        [self.contentView addSubview:view];
        [mutableViewArray addObject:view];
    }
    self.viewArray = [NSMutableArray arrayWithArray:mutableViewArray];
}
- (void)creatFourSubviews{
    
}

- (NSArray *)setDataInTheUIWithInNumber{
    return @[
  @{@"imageNameString":@"white_team",@"titleNameLabel":@"团队"},
  @{@"imageNameString":@"white_purchase",@"titleNameLabel":@"申购"},
  @{@"imageNameString":@"white_out",@"titleNameLabel":@"出金"},
  @{@"imageNameString":@"white_enter",@"titleNameLabel":@"入金"}
  ];
    

}
- (void)layoutSubviews{
    UIView *view1 = self.viewArray[0];
    UIView *view2 = self.viewArray[1];
    UIView *view3 = self.viewArray[2];
    __weak __typeof(&*self)weakSelf = self;
    [view1 mas_makeConstraints:^(MASConstraintMaker *make) {
        //
        make.top.equalTo(weakSelf.mas_top);
        make.left.equalTo(weakSelf.mas_left);
        make.bottom.equalTo(weakSelf.mas_bottom);
        make.right.equalTo(view2.mas_left);
        make.width.equalTo(view2.mas_width);
        make.width.equalTo(view3.mas_width);
    }];
    
    [view2 mas_makeConstraints:^(MASConstraintMaker *make) {
        //
        make.top.equalTo(weakSelf.mas_top);
        make.left.equalTo(view1.mas_right);
        make.bottom.equalTo(weakSelf.mas_bottom);
        make.right.equalTo(view3.mas_left);
        make.width.equalTo(view2.mas_width);
        make.width.equalTo(view3.mas_width);
    }];
    
    [view3 mas_makeConstraints:^(MASConstraintMaker *make) {
        //
        make.top.equalTo(weakSelf.mas_top);
        make.left.equalTo(view2.mas_right);
        make.bottom.equalTo(weakSelf.mas_bottom);
        make.right.equalTo(weakSelf.mas_right);
        make.width.equalTo(view2.mas_width);
        make.width.equalTo(view3.mas_width);
    }];
}

@end
